import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import '@/styles/index.less';
import App from './App.tsx';
import '@ant-design/v5-patch-for-react-19';
import { Provider } from 'react-redux';
import { store, persitor } from '@/redux/index.ts';
import { PersistGate } from 'redux-persist/integration/react';

createRoot(document.getElementById('root')!).render(
  // <StrictMode> (React严格模式)
  /*
    StrictMode → 开发规范检查
    Provider → 状态管理接入
    PersistGate → 持久化数据恢复 最后才会渲染真正的业务组件<App />
  */
  <StrictMode>
    {/* 包裹整个应用，使所有组件都能访问Redux store */}
    <Provider store={store}>
      {/* 在Redux状态加载完成前显示加载状态（可自定义loading属性） */}
      <PersistGate persistor={persitor}>
        <App />
      </PersistGate>
    </Provider>
  </StrictMode>,
);
